﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;
using System.Data;
using System.Data.SqlClient;
namespace DAO
{
    public class Khoa_DAO
    {
        public static DataTable DanhSachKhoa()
        {
            DataTable dt = DataProvider.SelectStoreProcedure("sp_DanhSachKhoa");
            return dt;
        }
        public static Boolean ThemKhoa(Khoa_DTO KhoaDto)
        {
            List<SqlParameter> ParaArr = new List<SqlParameter>();
            string procname = "sp_ThemKhoa";
            ParaArr.Add(new SqlParameter("@TenKhoa", KhoaDto.TenKhoa));
            ParaArr.Add(new SqlParameter("@MoTa", KhoaDto.MoTa));
            return DataProvider.NonqueryProc(procname, ParaArr);
        }

        public static Boolean CapNhatKhoa(Khoa_DTO KhoaDto)
        {
            List<SqlParameter> ParaArr = new List<SqlParameter>();
            string procname = "sp_CapNhatKhoa";
            ParaArr.Add(new SqlParameter("@MaKhoa", KhoaDto.MaKhoa));
            ParaArr.Add(new SqlParameter("@TenKhoa", KhoaDto.TenKhoa));
            ParaArr.Add(new SqlParameter("@MoTa", KhoaDto.MoTa));
            return DataProvider.NonqueryProc(procname, ParaArr);
        }

        public static Boolean XoaKhoa(string MaKhoa)
        {
            List<SqlParameter> ParaArr = new List<SqlParameter>();
            string procname = "sp_XoaKhoa";
            ParaArr.Add(new SqlParameter("@MaKhoa", MaKhoa));
            return DataProvider.NonqueryProc(procname, ParaArr);
        }
    }
}
